home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-05-23 | 15.9 KB | 403 lines | [TEXT/MMCC] |
- /*
- Copyright © 1991-1995 by TopSoft Inc. All rights reserved.
-
- You may distribute this file under the terms of the TopSoft
- Artistic License, accompanying this package.
-
- This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
- See the Modification History for more details.
-
- Product
- About Box
-
- FILE
- ABoxDefs.h
-
- NAME
- ABoxDefs.h, part of the ABox project source code,
- responsible for handling the AboutBox stuff.
-
- DESCRIPTION
- This file contains defines for the about box modules.
-
- DEVELOPED BY
- George (ty) Tempel netromancr@aol.com
- All code in this file, and its associated header file was
- Created by George (ty) Tempel in connection with the TopSoft, Inc.
- "FilterTop" application development, except where noted.
-
- CARETAKER - George (ty) Tempel <netromancr@aol.com>
- Please consult this person for any changes or suggestions to this file.
-
- MODIFICATION HISTORY
-
- dd mmm yy - xxx - patchxx: description of patch
- ?? Oct 92 - ty - Initial Version Created
- ?? Jul 93 - ty - d18, d19 fixes
- 05-oct-93 - ty - d25/26 changes for apple recommended
- greys for the 3d effects (see develop #15)
- 19-nov-93 - ty - d26 changes for improved update handling
- 26-jan-94 - ty - 1.0a3 changed "int" to "short int"
- 26-jan-94 - ty - 1.0a3 conversions for PowerPC/Universal-Headers conversion
- 01-feb-94 - ty - 1.0a3 changes to remove "register" keyword, remove use of "nrequire"
- and "require" error checking as sometimes they are confusing,
- fixed possible bug when dismissing the dialog while a movie
- is playing, and other small things. Mostly tried to edit
- the code to comply with the bulk of the Coding Standards document
- that Jim Brunner produced (nice work jim!)
- 22-feb-94 - ty - 1.0a4 patches to work better with universal headers, clear
- up some minor stuff, add FTQsort for universal header
- portability. Fixed some logic to better deal with the
- user having moved or eliminated our access to the FTSlides
- folder.
- 28-feb-94 - ty - 1.0a4 work to eliminate FTQsort (found a better
- way of fixing the header file collision created by the
- introduction of Apple Universal Headers into the Symantec
- compiler tree). Fixed up some of the user safety checks,
- return values, etc. Cleaned up more of the Universal Header
- support, and provided Universal Headers support in the
- ModalDialog() use.
- 09-mar-94 - ty - 1.0a4p2 Created functions:
- CreateTopicList(), CreateSlideList(), CreateSlideNumbers()
- to simplify dynamic memory management; GetABoxDialog(),
- SetABoxDialog(), GetABoxList(), SetABoxList(), GetABoxText(),
- SetABoxText(), GetABoxListVScroll(), SetABoxListVScroll(),
- GetABoxListHScroll(), SetABoxListHScroll() for abox structure
- management
- 17-mar-94 - ty - 1.0a5 applied edits to ensure all calls check their
- parameters for validity and have AssertStr() statements
- that can be conditionally compiled. Also, applied the
- multithreaded modal dialog tips from _develop_ #17, p 89-90. Also
- started to document the daylights out of everything.
- 14-apr-94 - ty - metropolis edits: adding kABTopicSlideResource 'TSAb' support
- for all slide/topic files including the application. Any file
- that should appear in the topic list _must_ have a TSAb resource
- within it (and only one!) that is a 1-based list of all
- resource family ID's to use as slides, in the order of
- appearance. So a TSAb resource that should display
- resources of ID's 400, 128, 345 should specify the
- slide ID's 400, 128, 345 in that order. No sorting is
- performed by the abox. Furthermore, the application fork
- should have a TSAb resource within it to designate
- 'primary slides' (which we had called default slides). Those
- slides are always attached to the "About this application..."
- topic at the top of the topic list.
- 28-apr-94 - ty - 1.0a9 edits: cleaned up constants in code, document more
- functionality and ensure error checking.
- 2-may-94 - ty - 1.0a9p2 edits: restored the original TS copyright header
- 3-may-94 - ty - 1.0a9p3 edits: added calling chain information
- 5-may-94 - ty - 1.0a9p4 edits: added speech manager support for clicking
- on the slide field area. If there is a kABstringResource
- and the speech manager is present then the 'title' will
- be spoken in the system's default voice. Cool! As such,
- I have added the functions IsSpeechAvailable() and DoSpeaking()
- 6-jun-94 - ty - 1.0a9p7 edits: changed function return type of CountAndLoadElementResources
- to OSErr...the ResourceInfoPtr was redundant since it is contained
- within the SlideListPtr structure
- 8-jun-94 - ty - 1.0a9p8 edits: THE BIG ONE!
- 1. I mostly cleaned up some loop conditionals and some error
- checking in order to debug the problem of the Great Crashing
- About Box under the PowerPC Mac 68k emulator. Most visibly
- I have reorganized the ABox source into many source files
- of much smaller and more manageable sizes. A few key loop
- conditionals were poorly constructed and _just_might_
- cause intermittent problems. I have tested the code on a
- PowerMac 6100/60-AV 8/250 with Metrowerks DR/3 release
- and it works without problems. In light of the new
- source for the ABox, you should remove any FTAboutBox.c
- and FTAboutBox.h files that you have in your project and
- incorporate the files in this distribution. If you wish to
- keep things neater, leave the new ABox code in the subfolders
- provided in this distribution.
-
- 2. I have changed the cosmetics of the topic list. I am letting
- the List Manager determine the best vertical size for the cells,
- but I am adjusting the height of the list to avoid cutting off
- any cells part way. I have always used the List Manager option to
- auto-scroll to the current cell, but if even a single pixel of
- the current cell is showing then the auto-scroll option has
- no effect. What I do now is downward-adjust (shorten) the height
- of the list to force the "cut-off" topic out of sight and let
- the List Manager take over. Long and short of it: it works fine now.
-
- 3. Once debugging on the PowerMac (wow is it fast! even when
- debugging the 68k abox code!) I noticed that I had a call
- duplicated in a body, which caused all slide elements to actually
- be processed twice...with sound resources this is most noticeable,
- or rather only noticeable, on a PowerMac, since the sound starts
- to play, is killed, then played again (all other things are
- way to fast to detect). The duplicated call came from an editing
- session where code was duplicated instead of moved. I removed the
- duplicate and now it all works.
-
- 4. I found a rather severe bug in the code regarding the
- usage of the external (to the abox) window updater function.
- I forgot to make edits for UPP/PowerPC usage, and as such
- the thing just might have crashed and burned on PPC boxes in
- native mode. I believe that I have corrected the problem.
-
- 5. The calling code (in our case, the function inside FTMenus.c)
- for the ABox _must_ create the external window updater UPP.
- Previously I had the calling code pass the function pointer,
- but in the spirit PPC-dom, the caller should create the UPP
- and hand the UPP over to the abox.
-
- 20-july-94 - ty - initial version for ABox Project released
- 23-may-95 - ty - changes for compatibility with the CodeWarrior CW6
- release and the associated Universal Headers from Apple:
- most methods that returned references now have "Ref" at
- the end of their methods names to prevent possible collisions
- with datatypes and classes of the same name (older versions
- of the compiler didn't have a problem with this).
- */
-
- /*===========================================================================*/
-
- /*========== Exclusion Macros ============*/
-
- #pragma once
-
- #ifndef _ABoxDefs_
- #define _ABoxDefs_
-
-
- /*============ Header Files ==============*/
-
-
- /*================ Macros ================*/
-
-
-
- /*============== Constants ===============*/
-
- // dialog box & items
-
- // _DialogDispatch is the trap for the new (system 7) dialog manager
- // calls SetDefaultItem, SetCancelItem, SetCursorTracking, which make
- // life a little easier for modal dialog programmers.
- #define _DialogDispatch 0xAA68 // 1.0a2 SJ moved over from FTAboutBox.c
-
- // Unimplemented Trap number
- #define kABUnimplTrap 0x9f // The "unimplmented" trap num
-
-
- // kABownerNameString and kABmachineNameString are what were referred to
- // as the "chooser name" information from pre-system 7 systems. These
- // string resources come from the Sharing Setup control panel and are used
- // by the about box to place the user's name into the topic list
- // to personalize the about box.
- #define kABownerNameString -16096
- #define kABmachineNameString -16413
-
- // dialog and dialog placement defines
- //
- // kABreduceFactor is used by ScaleRectToFit() to adjust the
- // geometry of a rectangular area to better (proportionally) fit
- // a given area.
- #define kABreduceFactor (0.75)
-
- // kABdialogSpacing is used by ResizeFields() to adjust the
- // positioning of the various slide elements of the about box.
- #define kABdialogSpacing (2)
-
- // kABtextFace, kABtextSize, kABtextFont are used to define
- // the quickdraw text characteristics of the about box dialog
- // elements, particularly the topic list and the slide title.
- // If slide-text items have style records, those are used to
- // define the slide-text, otherwise these characteristics play
- // there are well.
- #define kABtextFace (0) // plain
- #define kABtextSize (9) // size
- // 1.0a9p8 ty...changed the kABtextFont to the default application font
- //#define kABtextFont (geneva)
- #define kABtextFont (applFont)
-
- // kABtitleMaxHeight defines the maximum height of a slide
- // title block in the slide area.
- //#define kABtitleMaxHeight (short)(2.5 * kABtextSize) // d26 ty
-
- // kABscrollBarWidth and kABscrollBarMinLength are used
- // in the about box code to describe, respectively,
- // the width and minimum length of the scroll bar used by the
- // DoText() function to draw/display text records in the slide area.
- #define kABscrollBarWidth (16)
- #define kABscrollBarMinLength (55)
-
-
- // string resources
- //
- // kABStrings is a STR# resource containing some general
- // purpose strings for the about box.
- #define kABStrings 5001
- #define kABunknownUserInfo 1
- #define kABfolderSlide 2
- #define kABdefaultTopicName 3
- #define kABdefaultTopicNotice 4
- #define kAByourNameHereFile 5
-
- // the kABfolderTextSlide resource is a TEXT/styl
- // combination that explains why nothing interesting
- // has happened when the user selected a folder in the
- // topic list.
- #define kABfolderTextSlide 5001
-
-
- // kABErrorStrings is a STR# resource containing
- // all of the error strings used in reporting errors to the
- // user or programmer. This list will most likely continuously
- // grow as features are added to the about box.
- #define kABErrorStrings 5002
- #define kABErrMemoryAllocated 1
- #define kABErrMemoryDeallocated 2
- #define kABErrMemoryAllocationFailed 3
- #define kABErrNoQuickTime 4
- #define kABErrDialogMgrTrapsMissing 5
- #define kABErrBadArgStr255 6
- #define kABErrBadArgStringPtr 7
- #define kABErrBadArgTopicDialogPtr 8
- #define kABErrBadArgListHandle 9
- #define kABErrBadArgNumberOutOfRange 10
- #define kABErrBadArgTopicListPtr 11
- #define kABErrBadArgResourceInfoPtr 12
- #define kABErrBadArgSlideListPtr 13
- #define kABErrDialogItemNumberOutOfRange 14
- #define kABErrBadArgDialogPtr 15
- #define kABErrBadArgControlHandle 16
- #define kABErrBadArgRectPtr 17
- #define kABErrBadArgFileFolderCountPtr 18
- #define kABErrBadArgShortPtr 19
- #define kABErrBadArgTopicPtr 20
- #define kABErrBadArgSlideNumberPtr 21
- #define kABErrBadResourceHandlingTable 22
- #define kABErrBadResourceHandlingTableCount 23
- #define kABErrProblemsLoadingTopicSlideInfo 24
- #define kABErrProblemsCheckingControlStates 25
- #define kABErrBadArgWindowPtr 26
- #define kABErrBadArgTEHandle 27
- #define kABErrBadUpdateWindowUPP 28
- #define kABErrBadArgEventRecordPtr 29
- #define kABErrProblemsLoadingTopics 30
- #define kABErrProblemsCreatingTopicList 31
- #define kABErrBadArgSoundHandle 32
- #define kABErrSndPlaySync 33
- #define kABErrSndPlayAsync 34
- #define kABErrBadArgStrHandle 35
- #define kABErrBadArgTextHandle 36
- #define kABErrQuickTimeErrorCatch 37
- #define kABErrBadArgFSSpecPtr 38
- #define kABErrQuickTimeOpenMovieFile 39
- #define kABErrQuickTimeNewMovieFromFile 40
- #define kABErrBadArgPicHandle 41
- #define kABErrPossibleMemoryLeak 42
- #define kABErrBadArgTopicSlideResource 43
- #define kABErrErrorOpeningSlideFile 44
- #define kABErrInvalidSlideElementCount 45
-
- // dialog resources
- //
- // kABmodalDialog is the resource ID# for the about box dialog
-
- #define kABmodalDialog 5001
- #define kABmoveableModalDialog 5002
- #define kABmodelessDialog 5003
-
- // kABerror is the resource ID# for the about box alert
- // (error) dialog, used primarily by the ABoxError() function
- // for reporting runtime errors or possible memory leaks
- // to the user/programmer.
- #define kABerror 5003
-
- // dialog items...
- //
- // the following items are the dialog items contained
- // within the kABmodalDialog dialog box.
- #define kAboutBoxOK 1
- #define kAboutBoxAppAndVersion 2
- #define kAboutBoxTopic 3
- #define kAboutBoxSlideField 4
- #define kAboutBoxPrevButton 5
- #define kAboutBoxNextButton 6
- #define kAboutBoxPlayButton 7
- // these next items are pseudo-items, used in mapping
- // up/down arrows to DITL objects
- #define kAboutBoxPreviousTopic 8
- #define kAboutBoxNextTopic 9
-
- #define kActivateControl 0
- #define kDeactivateControl 0
-
- // general bad things...
- //
- // these defines are used to provide a more readable context
- // for error checking in the code. This list will constantly
- // vary as modifications are made to the about box.
- #define kABemptyStringLength (0)
- #define kABbadDialogItem (0)
- #define kABbadCautionAlertItem ((short)-1)
-
- // general good things...
- //
- // these defines are helpful constants used in various places of
- // the about box code.
- #define kABallocateDialogRecordStorage ((Ptr)0)
- #define kABdialogInFront ((WindowPtr)-1)
- #define kABfileNameLength ((short)32)
- #define kABlongNameLength ((short)80)
- #define kABstringSeparator ("\p/")
- #define kABcaseSensitive (true)
- #define kABcaseInsensitive (false)
- #define kABdiacriticalSensitive (true)
- #define kABdiacriticalInsensitive (false)
-
- // file type information for PBx calls; these defines
- // are usually always used in conjunction with a PBGetCatInfo()
- // call or some other PBxxx file manager function call.
- #define kABpbIsDirectory 0x0010
- #define kABpbQuery1Item ((short)0)
- #define kABpbQueryDirectory ((short)-1)
-
-
- /*================ Enums =================*/
-
- // key equates for keyboard navigation of the about box
- //
- // the enter, return, and escape keys function as normal in a modal dialog
- // the tab key really isn't used by the about box
- // the backspace really isn't used by the about box
- // the delete really isn't used by the about box
- // the left arrow will move to the preceeding slide
- // the right arrow will move to the next slide
- // the up arrow will move to the preceeding topic
- // the down arrow will move to the next topic
- enum {
- kEnterKey = 0x03,
- kBackSpace = 0x08,
- kTabKey = 0x09,
- kReturnKey = 0x0D,
- kEscKey = 0x1B,
- kLeftArrow = 0x1C,
- kRightArrow = 0x1d,
- kUpArrow = 0x1e,
- kDownArrow = 0x1f,
- kSpace = 0x20,
- kDeleteKey = 0x7F
- };
-
-
-
- /*=============== Structs ================*/
- /*=============== Typedefs ===============*/
- /*========== Function Prototypes =========*/
-
-
-
- #endif // _ABoxDefs_
-
- // end of file
-
-
-
-
-
-
-